persons =[{'name':'Pon4','age':32}, {'name':'Pon1','age':22}, {'name':'Pon3','age':41}, {'name':'Pon2','age':30} ] c = [[3, 50, 40, 3], [3, 50, 30, 2], [3, 60, 20, 6], [3, 60, 10, 7]] # 索引1 2 3升序 b = c.copy() b.sort(key=lambda x: (x[1], x[2], x[3])) aaa = sorted(persons,key=lambda x: (x['name'], -x['age'])) bbb = sorted(c,key=lambda x: (x[2], -x[3])) print(list) print(persons,'\n', aaa,'\n',bbb,'\n',b) #<class 'list'> # [{'name': 'Pon4', 'age': 32}, {'name': 'Pon1', 'age': 22}, {'name': 'Pon3', 'age': 41}, {'name': 'Pon2', 'age': 30}] # [{'name': 'Pon1', 'age': 22}, {'name': 'Pon2', 'age': 30}, {'name': 'Pon3', 'age': 41}, {'name': 'Pon4', 'age': 32}] # [[3, 60, 10, 7], [3, 60, 20, 6], [3, 50, 30, 2], [3, 50, 40, 3]] # [[3, 50, 30, 2], [3, 50, 40, 3], [3, 60, 10, 7], [3, 60, 20, 6]]